<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>用户管理系统</title>
<style>
.whole{text-align:center;
       height:600px;
       background-color:#E0FFFF;
}
.chuangkou{background-color:#FFFFFF;
           width:420px;
		   height:350px;
		   position:absolute;
		   right:80px;
		   top:90px;
		   padding-top:50px;
		   }
input[type="submit"]{
     width:275px;
	 height:35px;

}	
.text{
        width:275px;
	    height:35px;
		margin-bottom:40px;
		} 
</style>
</head>
<body>
<div class="whole">
     <div class="chuangkou"
   
        <form>
          账号:<input id="username" type="text" class="text" placeholder="用户名/邮箱"><br>
          密码:<input id="password" type="password" class="text" placeholder="输入密码">
               <input type="submit" class="text" value="登录" onclick="gotoLogin()"> 
		       <input type="submit" class="text" value="注册" onclick="gotoRegister()">	
        </form> 	   
     </div>
	 
</div>
<div class="denglu">

</div>
</body>

<script type="text/javascript">
	function gotoRegister() {
		window.open("./register.html");
	}
	function gotoLogin() {
		var usernameId = document.getElementById("username");
		var username = usernameId.value;
		if (username.length == 0) {
            alert("请输入用户名");
            return; 
		}

		var passwordId = document.getElementById("password");
		var password = passwordId.value;
		if (password.length == 0) {
			alert("请输入密码");
			return;
		}
        
        var storage = window.localStorage;
		var storagePassword = storage["password"];
		if (password != storagePassword) {
            alert("密码错误");
            return;
		}
		storage["token"] = password;
		window.open("./welcome.html");
	}
</script>

</html>
